package mapper;

import com.javabean.Student;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface StudentMapper {

    //默认当前方法使用 其他方法可以通过id复用
    @Select("select * from student")
    @Results(id = "s1",value = {
            @Result(id = true,property = "id",column = "s_id"),
            @Result(id = false,property = "name",column = "s_name"),
            @Result(id = false,property = "sex",column = "s_sex"),
            @Result(id = false,property = "age",column = "s_age" )
    })
    ArrayList<Student> selectAll();


    //可以通过ResultMap标签以及di复用其他映射结果
    @ResultMap("s1")
    @Select("select * from student where s_id=#{sid}")
    ArrayList<Student> selectBySid(int sid);

}
